package com.cloud.point.concurrent.general;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;

/**
 * 锁优化
 *
 * @author 24373
 * @version 1.0
 * @date 2024-06-15 01:25
 */
@Slf4j
public class TestSyncOptimize {

    public static void main(String[] args) {
        Obj obj = new Obj();
        ClassLayout classLayout = ClassLayout.parseInstance(obj);
        new Thread(() -> {
            log.info("{}", classLayout.toPrintable(obj));
            synchronized (obj) {
                log.info("{}", classLayout.toPrintable(obj));
            }
            log.info("{}", classLayout.toPrintable(obj));
        }).start();
    }

    static class Obj {
    }

}

